<?php $this->load->view('config/header_home');?>
<script type="text/javascript">	
	var group_id = <?php echo @$detail_police[0]['op_catatan']?>

	$(document).ready(function(){
		var d = new Date();
		var mount = d.getMonth();
		var year = d.getFullYear();
	
		$('#datepicker1').datepicker();
		$('#datepicker2').datepicker();
		$('#datepicker3').datepicker();
		
		document.getElementById('romMonth').value = getRomawiMonth(mount);
		document.getElementById('setYear').value = year;
		
		if(group_id){
			if(group_id == 1){
				$("#advanceSet").show();
			}else{
				$("#advanceSet").hide();
			}
		}else{
			$("#advanceSet").hide();
		}
	});
	
	function getShowItem(v){
		if(v == 1 || group_id == 1){
			$("#advanceSet").show();
		}else{
			$("#advanceSet").hide();
		}
	}	
</script>

<h2>Form <?php echo $mode?> blangko</h2>
<div class="line-separtor"></div>
<br/>	
	<a href="<?php echo site_url()?>blangko" class="btn btn-primary"> Kembali ke daftar </a>
<br/>
<form method="post" action="<?php echo site_url() ?>blangko/<?php echo $action; ?>" class="form-horizontal">
	<input type="hidden" class="span5" name="id_pengaju" value="<?php echo @$detail_pengaju[0]['id_pengaju']?>">
	<input type="hidden" class="span5" name="is_pengajuan" value="1">
	<h3>Identitas diri</h3>
	<div class="line-separtor"></div>
	<br/>
	<div class="control-group">
		<label class="control-label" for="ktp">No. KTP</label>
		<div class="controls">
		  <input type="text" class="span5" name="no_identitas_pengaju" value="<?php echo @$detail_pengaju[0]['no_identitas_pengaju']?>">
		</div>
	</div>
    <div class="control-group">
		<label class="control-label" for="ktp">No. Passport/KITAS/KIPAS</label>
		<div class="controls">
		  <input type="text" class="span5" name="no_passport" value="<?php echo @$detail_pengaju[0]['no_passport']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="nama">Nama lengkap</label>
		<div class="controls">
		  <input type="text" id="nama" class="span7" name="nama_pengaju" value="<?php echo @$detail_pengaju[0]['nama_pengaju']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="jk">Jenis kelamin</label>
		<div class="controls">
			<select name="jk_pengaju">
				<?php $selected1 =  '' ?>
				<?php $selected2 =  '' ?>
				
				<?php if (@$detail_pengaju[0]['jk_pengaju'] == "Laki-laki"):?>
					<?php $selected1 =  'selected="selected"' ?>
				<?php elseif (@$detail_pengaju[0]['jk_pengaju'] == "Perempuan") :?>
					<?php $selected2 =  'selected="selected"' ?>
				<?php else:?>
					<?php $selected1 =  '' ?>
					<?php $selected2 =  '' ?>
				<?php endif;?>
		  
				<option value="Laki-laki" <?php echo $selected1 ?> >Laki-laki</option>
				<option value="Perempuan" <?php echo $selected2 ?> >Perempuan</option>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="kebangsaan">Kebangsaan</label>
		<div class="controls">
			<select name="id_kebangsaan">
				<?php if (@$set_kebangsaan):?>
					<?php foreach ($set_kebangsaan as $row):?>
						<?php if ($row['id_kebangsaan'] == @$detail_pengaju[0]['id_kebangsaan']):?>
							<?php $selected =  'selected="selected"' ?>
						<?php else :?>
							<?php $selected =  '' ?>
						<?php endif;?>
						<option value="<?php echo $row['id_kebangsaan'] ?>" <?php echo $selected ?> ><?php echo $row['nama_kebangsaan'] ?></option>
					<?php endforeach?>
				<?php endif?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="agama">Agama</label>
		<div class="controls">
			<select name="id_agama">
				<?php if (@$set_agama):?>
					<?php foreach ($set_agama as $row):?>
						<?php if ($row['id_agama'] == @$detail_pengaju[0]['id_agama']):?>
							<?php $selected =  'selected="selected"' ?>
						<?php else :?>
							<?php $selected =  '' ?>
						<?php endif;?>
						<option value="<?php echo $row['id_agama'] ?>" <?php echo $selected ?> ><?php echo $row['nama_agama'] ?></option>
					<?php endforeach?>
				<?php endif?>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="tempat_lahir">Tempat lahir</label>
		<div class="controls">
		  <input type="text" class="span5" name="tempat_lahir_pengaju" value="<?php echo @$detail_pengaju[0]['tempat_lahir_pengaju']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="tgl_lahir">Tgl. Lahir</label>
		<div class="controls">
			
			<div class="input-append date" id="datepicker1" data-date="" data-date-format="dd-mm-yyyy">
				<?php 
					if(@$detail_pengaju[0]['tgl_lahir_pengaju']){
						$getDatelahir = date('d-m-Y', strtotime(@$detail_pengaju[0]['tgl_lahir_pengaju'])) ;
					}else{
						$getDatelahir = '';
					}
				?>
				<input class="span2" size="16" type="text" name="tgl_lahir_pengaju" value="<?php echo $getDatelahir ?>" />
				<span class="add-on"><i class="icon-th"></i></span>
			</div>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="alamat">Alamat</label>
		<div class="controls">
		  <textarea name="alamat_pengaju" class="span7" maxlength="255"><?php echo @$detail_pengaju[0]['alamat_pengaju']?></textarea>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="pekerjaan">Pekerjaan</label>
		<div class="controls">
			<select name="id_pekerjaan">
				<?php if (@$set_pekerjaan):?>
					<?php foreach ($set_pekerjaan as $row):?>
						<?php if ($row['id_pekerjaan'] == @$detail_pengaju[0]['id_pekerjaan']):?>
							<?php $selected =  'selected="selected"' ?>
						<?php else :?>
							<?php $selected =  '' ?>
						<?php endif;?>
						<option value="<?php echo $row['id_pekerjaan'] ?>" <?php echo $selected ?> ><?php echo $row['nama_pekerjaan'] ?></option>
					<?php endforeach?>
				<?php endif?>
			</select>
		</div>
	</div>

	<h4>Keterangan SKCK</h4>
	<div class="line-separtor"></div>
	<br/>
	<div class="control-group">
		<label class="control-label" for="no_seri">No. Seri Blangko</label>
		<div class="controls">
		  <input type="text" class="span3" name="no_seri" value="<?php echo @$detail_police[0]['no_seri']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="no_kwitansi">No. Kwitansi</label>
		<div class="controls">
		  <input type="text" class="span3" name="no_kwitansi" value="<?php echo @$detail_police[0]['no_kwitansi']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="no_agenda">No. Agenda</label>
		<div class="controls">
		  <input type="text" class="span3" name="no_agenda" value="<?php echo @$detail_police[0]['no_agenda']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="no_surat">Bulan</label>
		<div class="controls">
			<input type="text" class="span1" id="romMonth" name="nomor_bulan" value="<?php echo @$detail_police[0]['nomor_bulan']?>" placeholder="Bulan"> - 
			<input type="text" class="span1" id="setYear" name="nomor_tahun" value="<?php echo @$detail_police[0]['nomor_tahun']?>" placeholder="Tahun">
			<!--input type="text" class="span3" name="nomor_sat" value="<?php echo @$detail_police[0]['nomor_sat']?>" placeholder="Sat Intelkam"-->
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="tgl_terbit_police">Tgl. Penerbitan</label>
		<div class="controls">
			<div class="input-append date" id="datepicker2" data-date="" data-date-format="dd-mm-yyyy">
				<?php 
					if(@$detail_police[0]['tgl_terbit_police']){
						$getDateTerbit = date('d-m-Y', strtotime(@$detail_police[0]['tgl_terbit_police'])) ;
					}else{
						$getDateTerbit = date('d-m-Y');
					}
				?>
				<input class="span2" size="16" type="text" name="tgl_terbit_police" value="<?php echo $getDateTerbit ?>"/>
				<span class="add-on"><i class="icon-th"></i></span>
			</div>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="tgl_akhir_berlaku">Tgl. Akhir berlaku</label>
		<div class="controls">
			<div class="input-append date" id="datepicker3" data-date="" data-date-format="dd-mm-yyyy">
				<?php 
					if(@$detail_police[0]['tgl_akhir_berlaku']){
						$getDateAkhir = date('d-m-Y', strtotime(@$detail_police[0]['tgl_akhir_berlaku'])) ;
					}else{
						$getDateAkhir = date('d-m-Y');
					}
				?>
				<input class="span2" size="16" type="text" name="tgl_akhir_berlaku" value="<?php echo $getDateAkhir?>"/>
				<span class="add-on"><i class="icon-th"></i></span>
			</div>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="keperluan">Keperluan</label>
		<div class="controls">
		  <textarea name="keperluan" class="span5"><?php echo @$detail_police[0]['keperluan']?></textarea>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="sidik_jari_atas">Sidik jari atas</label>
		<div class="controls">
		  <input type="text" name="sidik_jari_atas" value="<?php echo @$detail_police[0]['sidik_jari_atas']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="sidik_jari_bawah">Sidik jari bawah</label>
		<div class="controls">
			<input type="text" name="sidik_jari_bawah" value="<?php echo @$detail_police[0]['sidik_jari_bawah']?>">
		</div>
	</div>
	
	<div class="control-group">
		<label class="control-label" for="op_catatan">Dengan catatan</label>
		<div class="controls">
			<select name="op_catatan" onChange="getShowItem(this.value)">
				<?php if (@$detail_police[0]['op_catatan'] == 1):?>
					<?php $selected =  'selected="selected"' ?>
				<?php else :?>
					<?php $selected =  '' ?>
				<?php endif;?>
				<option value="0">Tidak</option>
				<option value="1" <?php echo $selected ?>>Ya</option>
			</select>
		</div>
	</div>
	
	<div id="advanceSet">
		<div class="control-group">
			<label class="control-label" for="pasal">Pasal</label>
			<div class="controls">
			  <input type="text" name="pasal" value="<?php echo @$detail_police[0]['pasal']?>">
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="undang_undang">Undang-Undang No.</label>
			<div class="controls">
				
			  <input type="text" name="undang_undang" value="<?php echo @$detail_police[0]['undang_undang']?>">
			</div>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="ttd_perwakilan">TTD Perwakilan</label>
		<div class="controls" style="padding-top:5px">
			<?php 
				if(@$detail_police[0]['ttd_perwakilan'] == 1){
					$check = "checked";
				}else{
					if($action == "save"){
						$check = "checked";
					}else{
						$check = "";
					}
				}
			?>
			<input type="checkbox" name="ttd_perwakilan" value="1" <?php echo $check; ?> />
		</div>
	</div>
	<div class="form-actions">
	  <input type="submit" name="submit" value="Simpan" class="btn btn-primary"/>
	  <a href="<?php echo site_url()?>blangko" class="btn">Batal</a>
	</div>
</form>
<?php $this->load->view('config/footer_home');?>